package com.striker.nettyconn;

import java.util.Map;

//负责转发。和server3Handler通过rpc通讯。
public class ForwardServer {
    private Map<UinRange, ServerInfo> biggestUin2Server;//按区间划分服务器

    public boolean forward(Model m){
        // 找到对应的服务器
        ServerInfo serverInfo = findServerInfo(m.getToUin());

        // 转发
        return true;
    }

    public ServerInfo findServerInfo(long uin){
        for(UinRange uinRange : biggestUin2Server.keySet()){
            if(uin >= uinRange.getLowUin() && uin < uinRange.getHighUin()){
                return biggestUin2Server.get(uinRange);
            }
        }
        return null;
    }

}
